package com.sxt.redis.scheduled;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledTask {
	
	@Autowired
    private RedisTemplate redisTemplate;
	/**
	 * 10秒执行一次，手动心跳
	 */
	@Scheduled(cron = "0/10 * * * * *")
    public void timer() {
		redisTemplate.opsForValue().get("heartbeat");
		System.out.println("手动心跳");
    }
}
